package com.wulijie.state;

import java.util.Random;

/**
 * @Author cui
 * @Data
 */
public class CanGetGift extends State{
    RaffleActivity raffleActivity;

    public CanGetGift(RaffleActivity raffleActivity) {
        this.raffleActivity = raffleActivity;
    }

    @Override
    public void isOk() {
        System.out.println("开始抽奖");

        Random random = new Random();
        int anInt = random.nextInt();

        if (anInt > 5) {
            System.out.println("恭喜获得奖品");
        } else {
            System.out.println("很遗憾您没有中奖");
        }

        this.raffleActivity.setState(this.raffleActivity.getNoCanGet());
    }
}
